package com.maserb.monitor.entity.card;

import lombok.Data;

@Deprecated
@Data
public class CardPackageHeaderEntity {
    private String odw;
    private String sourceCode;
    private String destCode;
    private String recieveState;
    private String functionCode;
    private String sendPackageNumber;
    private String responsePackageNumber;
    private Integer packageLength;

    public static CardPackageHeaderEntity convert(String sequence, Box<Integer> index) {
        CardPackageHeaderEntity entity = new CardPackageHeaderEntity();
        entity.setOdw(CardUtils.get(sequence, index, 3));
        entity.setSourceCode(CardUtils.get(sequence, index, 12));
        entity.setDestCode(CardUtils.get(sequence, index, 12));
        entity.setRecieveState(CardUtils.get(sequence, index, 1));
        entity.setFunctionCode(CardUtils.get(sequence, index, 2));
        entity.setSendPackageNumber(CardUtils.get(sequence, index, 4));
        entity.setResponsePackageNumber(CardUtils.get(sequence, index, 4));
        entity.setPackageLength(Integer.valueOf(CardUtils.get(sequence, index, 4)));
        return entity;
    }
}
